home *** CD-ROM | disk | FTP | other *** search
- From dialupip-request@SH.CS.NET Mon Feb 11 10:02:41 1991
- Received: from sh.cs.net by uunet.uu.net (5.61/1.14) with SMTP
- id AA02294; Mon, 11 Feb 91 10:01:45 -0500
- Message-Id: <9102111501.AA02294@uunet.uu.net>
- Received: from sh.cs.net by SH.CS.NET id aa20448; 11 Feb 91 9:46 EST
- Date: Mon, 11 Feb 91 14:40:48 GMT
- From: John Curran <jcurran@SH.CS.NET>
- To: dialupip@SH.CS.NET
- Subject: Dialupip 2.0 patch #1
- Status: OR
-
- Patch #1 to dialupip 2.0 changes the following routines:
-
- dulib/log.c Corrects output and possible address specification
- error when using log formats with "%x" (hex) symbol.
-
- dumisc/duioctl.c
- Corrects output and possible address specification
- error when setting SOFTTIMER.
-
- diald/diald.c Adds logging of packet source, destination, and protocol
- causing line activation.
- Improve readability of log messages.
- Remove spurious "diald exiting" messages.
-
- While dialupip will work fine without this patch, it's installation makes
- debugging dialupip services easier.
-
- /John
-
- ====== patch follows =====
- *** /tmp/,RCSt1a20184 Mon Feb 11 09:23:21 1991
- --- log.c Fri Feb 8 15:49:43 1991
- ***************
- *** 99,105 ****
- break;
- case 'o': case 'c': case 'd': case 's': case 'u':
- case 'e': case 'E': case 'f': case 'g': case 'G':
- ! case 'm':
- done++;
- /* FALLTHROUGH */
- case ' ': case '+': case '-': case '.': case '#':
- --- 99,105 ----
- break;
- case 'o': case 'c': case 'd': case 's': case 'u':
- case 'e': case 'E': case 'f': case 'g': case 'G':
- ! case 'm': case 'x':
- done++;
- /* FALLTHROUGH */
- case ' ': case '+': case '-': case '.': case '#':
- *** /tmp/,RCSt1a20189 Mon Feb 11 09:23:22 1991
- --- duioctl.c Fri Feb 8 15:54:20 1991
- ***************
- *** 175,181 ****
- fatal("Can't SIOCSATIMEO");
- d_log(DLOG_GENERAL, WHERE, "Set ATIMEO on \"%s\" to %d",
- device, i);
- ! (void)printf("Set ATIMEO to %d\n", s);
- }
- else if (EQ(*argv, "SWTIMEO")) {
- i = getnumber(argv[0], argv[1]);
- --- 175,181 ----
- fatal("Can't SIOCSATIMEO");
- d_log(DLOG_GENERAL, WHERE, "Set ATIMEO on \"%s\" to %d",
- device, i);
- ! (void)printf("Set ATIMEO to %d\n", i);
- }
- else if (EQ(*argv, "SWTIMEO")) {
- i = getnumber(argv[0], argv[1]);
- ***************
- *** 194,200 ****
- if (ioctl(s, SIOCSSOFTTIMER, (caddr_t)&ifr) < 0)
- fatal("Can't SIOCSSOFTTIMER");
- d_log(DLOG_GENERAL, WHERE, "Set SOFTTIMER on \"%s\" to %d",
- ! i, device);
- (void)printf("Set SOFTTIMER to %d\n", i);
- }
- else if (EQ(*argv, "ENABLECALL")) {
- --- 194,200 ----
- if (ioctl(s, SIOCSSOFTTIMER, (caddr_t)&ifr) < 0)
- fatal("Can't SIOCSSOFTTIMER");
- d_log(DLOG_GENERAL, WHERE, "Set SOFTTIMER on \"%s\" to %d",
- ! device, i);
- (void)printf("Set SOFTTIMER to %d\n", i);
- }
- else if (EQ(*argv, "ENABLECALL")) {
- *** /tmp/,RCSt1a20194 Mon Feb 11 09:23:24 1991
- --- diald.c Fri Feb 8 15:56:28 1991
- ***************
- *** 84,102 ****
- register REMOTE *rp;
- register struct du_pkt *pkt;
- {
- ! register int i;
- register TABLE *tp;
- struct timeval tv;
- struct tm *tm;
-
- /* check protocol */
- ! i = pkt->du_ip.ip_p;
- ! if ((rp->Protocols[P_WORD(i)] & P_BIT(i)) == 0) {
- ! for (tp = ProtocolNames; tp->Name; tp++)
- ! if (i == tp->Protocol)
- ! break;
- ! d_log(DLOG_INFO, WHERE, "Bad protocol %s (%d)",
- ! tp ? tp->Name : "unknown");
- return 0;
- }
-
- --- 84,106 ----
- register REMOTE *rp;
- register struct du_pkt *pkt;
- {
- ! register int pnum;
- register TABLE *tp;
- + char *pname;
- + char srcaddr[20];
- struct timeval tv;
- struct tm *tm;
-
- + pnum = pkt->du_ip.ip_p;
- + for (tp = ProtocolNames; tp->Name; tp++)
- + if (pnum == tp->Protocol)
- + break;
- + pname = tp ? tp->Name : "unknown";
- +
- /* check protocol */
- ! if ((rp->Protocols[P_WORD(pnum)] & P_BIT(pnum)) == 0) {
- ! d_log(DLOG_INFO, WHERE, "Unauthorized protocol %s (%d)",
- ! pname, pnum);
- return 0;
- }
-
- ***************
- *** 110,130 ****
- return 0;
- }
- if ((rp->Times[tm->tm_wday] & (1L << tm->tm_hour)) == 0) {
- ! d_log(DLOG_INFO, WHERE, "Bad time to call");
- return 0;
- }
-
- /* Check addresses. */
- if (rp->AllowCount && !hostinlist(rp->AllowTo, pkt->du_ip.ip_dst)) {
- ! d_log(DLOG_INFO, WHERE, "Bad destination address \"%s\"",
- inet_ntoa(pkt->du_ip.ip_dst));
- return 0;
- }
- if (rp->DisallowCount && hostinlist(rp->DisallowFrom, pkt->du_ip.ip_src)) {
- ! d_log(DLOG_INFO, WHERE, "Bad source address \"%s\"",
- inet_ntoa(pkt->du_ip.ip_src));
- return 0;
- }
-
- /* o.k. to make call */
- return 1;
- --- 114,138 ----
- return 0;
- }
- if ((rp->Times[tm->tm_wday] & (1L << tm->tm_hour)) == 0) {
- ! d_log(DLOG_INFO, WHERE, "Unauthorized time of day");
- return 0;
- }
-
- /* Check addresses. */
- if (rp->AllowCount && !hostinlist(rp->AllowTo, pkt->du_ip.ip_dst)) {
- ! d_log(DLOG_INFO, WHERE, "Unauthorized destination address \"%s\"",
- inet_ntoa(pkt->du_ip.ip_dst));
- return 0;
- }
- +
- if (rp->DisallowCount && hostinlist(rp->DisallowFrom, pkt->du_ip.ip_src)) {
- ! d_log(DLOG_INFO, WHERE, "Unauthorized source address \"%s\"",
- inet_ntoa(pkt->du_ip.ip_src));
- return 0;
- }
- + (void)sprintf(srcaddr, "%s", inet_ntoa(pkt->du_ip.ip_src));
- + d_log(DLOG_INFO, WHERE, "Authorized packet [%s -> %s], proto %s (%d)",
- + srcaddr, inet_ntoa(pkt->du_ip.ip_dst), pname, pnum);
-
- /* o.k. to make call */
- return 1;
- ***************
- *** 260,266 ****
- if ((i = read(f, (char *)&pkt, sizeof pkt)) != sizeof pkt) {
- if (errno != EINTR)
- d_log(DLOG_GENERAL, WHERE,
- ! "Bad read (%d bytes) from \"%s\", %m",
- i, DEVDIAL);
- continue;
- }
- --- 268,274 ----
- if ((i = read(f, (char *)&pkt, sizeof pkt)) != sizeof pkt) {
- if (errno != EINTR)
- d_log(DLOG_GENERAL, WHERE,
- ! "failed read (%d bytes) from \"%s\", %m",
- i, DEVDIAL);
- continue;
- }
- ***************
- *** 268,282 ****
- /* Find config data for the address. */
- (void)sprintf(buff, "%s%d", pkt.du_ifname, pkt.du_ifunit);
- if ((rp = findconfig(buff)) == NULL) {
- ! d_log(DLOG_GENERAL, WHERE, "Address %s not configured",
- ! inet_ntoa(pkt.du_sin.sin_addr));
- continue;
- }
-
- /* Is this packet is authorized? */
- if (pkt.du_checkit && !authorized(rp, &pkt)) {
- ! (void)sprintf(buff, "%s not authorized to reach %s",
- ! inet_ntoa(pkt.du_ip.ip_src), inet_ntoa(pkt.du_ip.ip_dst));
- failcall(rp->Device, buff);
- continue;
- }
- --- 276,289 ----
- /* Find config data for the address. */
- (void)sprintf(buff, "%s%d", pkt.du_ifname, pkt.du_ifunit);
- if ((rp = findconfig(buff)) == NULL) {
- ! d_log(DLOG_GENERAL, WHERE, "Interface \"%s\" not configured",
- ! buff);
- continue;
- }
-
- /* Is this packet is authorized? */
- if (pkt.du_checkit && !authorized(rp, &pkt)) {
- ! (void)sprintf(buff, "access controls");
- failcall(rp->Device, buff);
- continue;
- }
- ***************
- *** 289,295 ****
- if ((i = fork()) == 0) {
- (void)setpgrp(0, getpgrp(0));
- makecall(rp);
- ! break;
- }
- if (i < 0)
- d_log(DLOG_GENERAL, WHERE, "Can't fork dialing process, %m");
- --- 296,302 ----
- if ((i = fork()) == 0) {
- (void)setpgrp(0, getpgrp(0));
- makecall(rp);
- ! exit(0);
- }
- if (i < 0)
- d_log(DLOG_GENERAL, WHERE, "Can't fork dialing process, %m");
-
-